<template>
  <div class="content">
    <!-- 顶部图标 -->
    <div class="top">
      <div class="header">
        <img alt="logo" class="logo" src="@/assets/img/login/registerLogo.png" />
        <!-- <span class="title">陇县奶山羊大数据平台</span> -->
      </div>
      <!-- <div class="desc">Ant Design 是西湖区最具影响力的 Web 设计规范</div> -->
    </div>
    <!-- 表单提交区域 -->
    <div class="bottom">
      <div class="bottom-content">
        <!-- 进度条区域-->
        <div class="steps">
          <a-steps :current="current" labelPlacement="vertical">
            <a-step
              v-for="item in steps"
              :key="item.title"
              :title="item.title"
            />
          </a-steps>
        </div>
        <!-- 表单区域 -->
        <!-- 步骤条第一部分 内容申请企业账号 -->
        <div v-show="current == 0">
          <a-form-model
            ref="registerFormRef"
            :label-col="labelCol"
            :wrapper-col="wrapperCol"
            :rules="firstRules"
            :model="registerForm_1"
          >
            <a-form-model-item label="用户名: " prop="loginName">
              <a-input
                size="large"
                placeholder="请输入用户名"
                v-model="registerForm_1.loginName"
              />
            </a-form-model-item>
            <a-form-model-item label="手机号码: " prop="mobilePhone">
              <a-input
                size="large"
                placeholder="请输入手机号码"
                v-model="registerForm_1.mobilePhone"
              />
            </a-form-model-item>
            <!-- <a-form-model-item label="手机验证码: ">
                <a-input size='large' placeholder="请输入短信验证码">
                  <span @click="getCode" :class="disabled==1?'disabled':''">{{codeText}}</span>
                </a-input>
              </a-form-model-item> -->
            <a-form-model-item
              label="手机验证码"
              class="phoneYZM"
              prop="verifyCode"
              style="position: relative"
            >
              <a-input
                placeholder="请输入手机验证码"
                size="large"
                v-model="registerForm_1.verifyCode"
              />
              <a-button
                :disabled="disabled"
                @click="sendCode"
                class="sendYZMbtn"
                >{{ text }}</a-button
              >
            </a-form-model-item>

            <a-form-model-item label="设置密码: " prop="password">
              <a-input
                size="large"
                placeholder="请设置6-20位登录密码"
                type="passWord"
                v-model="registerForm_1.password"
              />
            </a-form-model-item>
            <a-form-model-item label="确认密码: " prop="passwordSecond">
              <a-input
                size="large"
                placeholder="请再次输入登录密码"
                type="passWord"
                v-model="registerForm_1.passwordSecond"
              />
            </a-form-model-item>
            <a-form-model-item label="注册类型: " prop="roleCode">
              <a-input-group compact>
                <a-select
                  style="width: 100%"
                  size="large"
                  placeholder="请选择"
                  v-model="registerForm_1.roleCode"
                >
                  <a-select-option
                    :value="item.code"
                    v-for="item in RegistrationList"
                    :key="item.name"
                  >
                    {{ item.name }}
                  </a-select-option>
                </a-select>
              </a-input-group>
            </a-form-model-item>
            <a-form-model-item label=" " :colon="false">
              <a-checkbox @change="onChange">
                勾选同意<span>《用户服务协议》</span>
              </a-checkbox>
            </a-form-model-item>
            <a-form-model-item class="registerBtn">
              <a-button type="primary" block @click="onSubmit"> 注册 </a-button>
            </a-form-model-item>
          </a-form-model>
        </div>
        <!-- 第二部分内容 企业信息录入-->
        <div class="reviewResults" v-if="reviewResults">
          <div class="title-style">审核结果</div>
          <div>
            <div>
              <p>
                <span>*</span>审核状态：<span>{{ auditStatus }}</span>
              </p>
              <p>
                <span>*</span>审核意见：<span>{{ auditOpinion }}</span>
              </p>
            </div>
            <div>
              <p>
                <span>*</span>审核日期：<span>{{ auditTime }}</span>
              </p>
              <p>
                <span>*</span>审核人：<span>{{ auditPerson }}</span>
              </p>
            </div>
          </div>
        </div>

        <div v-show="current == 1">
          <div class="title-style">基础信息</div>
          <a-form-model
            v-if="catalogue == 0"
            ref="registerFormRef2"
            :label-col="labelCol"
            :wrapper-col="wrapperCol"
            :model="registerForm_2"
            :rules="secondRules"
          >
            <a-form-model-item label="企业名称" prop="enterpriseName">
              <a-input size="large" v-model="registerForm_2.enterpriseName">
                <a-tooltip slot="suffix" title="请填写营业执照上完整的公司名称">
                  <a-icon
                    type="info-circle"
                    style="color: rgba(0, 0, 0, 0.45)"
                  />
                </a-tooltip>
              </a-input>
            </a-form-model-item>
            <a-form-model-item
              label="统一社会信用代码"
              prop="unifiedSocialCreditCode"
            >
              <a-input
                size="large"
                v-model="registerForm_2.unifiedSocialCreditCode"
              ></a-input>
            </a-form-model-item>
            <a-form-model-item label="企业成立日期" prop="foundDate">
              <a-date-picker
                :value="registerForm_2.foundDate"
                size="large"
                @change="onDateChange"
              />
            </a-form-model-item>
            <a-form-model-item label="企业类型名称" prop="enterpriseTypeCode">
              <a-input-group compact>
                <a-select
                  style="width: 100%"
                  size="large"
                  v-model="registerForm_2.enterpriseTypeCode"
                >
                  <a-select-option
                    :value="item.code"
                    v-for="item in businessTypeArr"
                    :key="item.name"
                  >
                    {{ item.name }}
                  </a-select-option>
                </a-select>
              </a-input-group>
            </a-form-model-item>
            <a-form-model-item label="企业属性" prop="enterprisePropCode">
              <a-input-group compact>
                <a-select
                  style="width: 100%"
                  size="large"
                  v-model="registerForm_2.enterprisePropCode"
                >
                  <a-select-option
                    :value="item.code"
                    v-for="item in businessPropArr"
                    :key="item.name"
                  >
                    {{ item.name }}
                  </a-select-option>
                </a-select>
              </a-input-group>
            </a-form-model-item>
            <a-form-model-item label="法定代表人" prop="representativeName">
              <a-input
                size="large"
                v-model="registerForm_2.representativeName"
              ></a-input>
            </a-form-model-item>
            <a-form-model-item label="联系电话">
              <a-input
                size="large"
                v-model="registerForm_2.enterpriseContactPhone"
              ></a-input>
            </a-form-model-item>
            <!-- 企业选择省市区地址以及详细地址 -->
            <!-- 辅助注册 删除经营地址校验规则-->
            <!-- <a-form-model-item label="经营地址" prop = "businessAdress"> -->
            <a-form-model-item label="经营地址" prop="businessAddress">
              <a-input-group compact>
                <a-cascader
                  style="width: 50%"
                  :options="businessAdressBase"
                  placeholder="请选择省市县地区"
                  size="large"
                  :value="[
                    registerForm_2.businessProvinceCode,
                    registerForm_2.businessCityCode,
                    registerForm_2.businessCountyCode,
                  ]"
                  @change="addressChange"
                />
                <a-input
                  size="large"
                  placeholder="请输入详细地址"
                  style="width: 50%"
                  v-model="registerForm_2.businessAddress"
                ></a-input>
              </a-input-group>
            </a-form-model-item>
            <!-- 注册资本 -->
            <a-form-model-item
              label="总注册资本 (万元)"
              prop="registeredCapital"
            >
              <a-input
                size="large"
                v-model="registerForm_2.registeredCapital"
              ></a-input>
            </a-form-model-item>
            <a-form-model-item label="经营范围" prop="businessScope">
              <a-textarea
                placeholder="请输入内容"
                :autoSize="{ minRows: 4 }"
                :maxLength="500"
                v-model="registerForm_2.businessScope"
              />
            </a-form-model-item>
            <!-- 企业选择上传营业执照 -->
            <!-- 辅助注册,删除营业执照的校验规则 -->
            <a-form-model-item label="营业执照"  prop = "businessCertificateImg">
              <div style="position: relative">
                <span
                  style="
                    position: absolute;
                    color: red;
                    z-index: 999;
                    top: 2px;
                    left: -80px;
                  "
                  >*</span
                >
              </div>
              <a-upload
                name="file"
                list-type="picture-card"
                class="avatar-uploader"
                :show-upload-list="false"
                action="/fms/api/uploadForAmis"
                :before-upload="beforeUpload"
                @change="handleChange"
              >
                <img
                  v-if="imageUrl"
                  :src="imageUrl"
                  alt="avatar"
                  style="width: 102px; height: 102px"
                />
                <div v-else>
                  <a-icon :type="loading ? 'loading' : 'plus'" />
                  <div class="ant-upload-text">Upload</div>
                </div>
              </a-upload>
              <div style="color: #ccc">
                支持格式：JPG、JPEG、PNG，最多上传1张照片，单个不超过5M
              </div>
            </a-form-model-item>
            <!-- 底部按钮区域 -->
            <a-form-model-item
              label=""
              :wrapper-col="{ span: 14, offset: 4 }"
              class="bottom-button"
            >
              <!-- <a-button style="margin-right: 30px" @click="goToPrev"
                >上一步</a-button
              > -->
              <a-button type="primary" @click="goToNext">下一步</a-button>
            </a-form-model-item>
          </a-form-model>
          <a-form-model
            v-if="catalogue == 1"
            ref="registerFormRefYzc"
            :label-col="labelCol"
            :wrapper-col="wrapperCol"
            :model="registerForm_yzc"
            :rules="secondRules1"
          >
            <a-form-model-item label="养殖场名称" prop="yzcName">
              <a-input size="large" v-model="registerForm_yzc.yzcName">
              </a-input>
            </a-form-model-item>
            <a-form-model-item label="负责人身份证号" prop="yzcCreditCode">
              <a-input
                size="large"
                v-model="registerForm_yzc.yzcCreditCode"
              ></a-input>
            </a-form-model-item>
            <a-form-model-item label="成立日期" prop="yzcDate">
              <a-date-picker
                :value="registerForm_yzc.yzcDate"
                size="large"
                @change="onDateChangeYzc"
              />
            </a-form-model-item>
            <a-form-model-item label="负责人" prop="yzcEnterpriseName">
              <a-input
                size="large"
                v-model="registerForm_yzc.yzcEnterpriseName"
              >
              </a-input>
            </a-form-model-item>
            <a-form-model-item label="联系电话" prop="yzcContactNumber">
              <a-input size="large" v-model="registerForm_yzc.yzcContactNumber">
              </a-input>
            </a-form-model-item>
            <a-form-model-item
              label="经营地址省市区/县"
              prop="yzcBusinessAddress"
            >
              <a-input-group compact>
                <a-cascader
                  style="width: 50%"
                  :options="businessAdressBase"
                  placeholder="请选择省市县地区"
                  :value="[
                    registerForm_yzc.yzcProvinceCode,
                    registerForm_yzc.yzcCityCode,
                    registerForm_yzc.yzcCountyCode,
                  ]"
                  size="large"
                  @change="addressChange1"
                />
                <a-input
                  size="large"
                  placeholder="请输入详细地址"
                  style="width: 50%"
                  v-model="registerForm_yzc.yzcBusinessAddress"
                ></a-input>
              </a-input-group>
            </a-form-model-item>
            <a-form-model-item label="经营范围" prop="yzcBusinessScope">
              <a-textarea
                placeholder="请输入内容"
                :autoSize="{ minRows: 4 }"
                :maxLength="500"
                v-model="registerForm_yzc.yzcBusinessScope"
              />
            </a-form-model-item>
            <a-form-model-item label="身份证照片" prop="yzcCertificateImg">
              <div style="position: relative">
                <span
                  style="
                    position: absolute;
                    color: red;
                    z-index: 999;
                    top: 2px;
                    left: -93px;
                  "
                  >*</span
                >
              </div>
              <!-- <a-upload
                name="file"
                list-type="picture-card"
                class="avatar-uploader"
                :show-upload-list="false"
                action="/fms/api/uploadForAmis"
                :before-upload="beforeUpload"
                @change="handleChangeYzc"
              >
                <img
                  v-if="imageUrl"
                  :src="imageUrl"
                  alt="avatar"
                  style="width: 102px; height: 102px"
                />
                <div v-else>
                  <a-icon :type="loading ? 'loading' : 'plus'" />
                  <div class="ant-upload-text">上传图片</div>
                </div> -->
              <!-- </a-upload> -->
              <a-upload
                action="/fms/api/uploadForAmis"
                list-type="picture-card"
                :file-list="fileList"
                @preview="handlePreview"
                @change="handleChanges"
              >
                <div v-if="fileList.length < 2">
                  <a-icon type="plus" />
                  <div class="ant-upload-text">上传图片</div>
                </div>
              </a-upload>
              <a-modal
                :visible="previewVisible"
                :footer="null"
                @cancel="handleCancel"
              >
                <img alt="example" style="width: 100%" :src="previewImage" />
              </a-modal>
              <div style="color: #ccc">
                支持格式：JPG、JPEG、PNG，最多上传2张照片，单个不超过5M
              </div>
            </a-form-model-item>

            <!-- 底部按钮区域 -->
            <a-form-model-item
              label=""
              :wrapper-col="{ span: 14, offset: 4 }"
              class="bottom-button"
            >
              <!-- <a-button style="margin-right: 30px" @click="goToPrev"
                >上一步</a-button
              > -->
              <a-button type="primary" @click="goToNextYzc">下一步</a-button>
            </a-form-model-item>
          </a-form-model>
          <a-form-model
            v-if="catalogue == 2"
            ref="registerFormRefZj"
            :label-col="labelCol"
            :wrapper-col="wrapperCol"
            :model="registerForm_zj"
            :rules="secondRules2"
          >
            <a-form-model-item label="头像" prop="headPortrait">
              <div style="position: relative">
                <span
                  style="
                    position: absolute;
                    color: red;
                    z-index: 999;
                    top: 1px;
                    left: -50px;
                  "
                  >*</span
                >
              </div>
              <a-upload
                action="/fms/api/uploadForAmis"
                list-type="picture-card"
                :file-list="fileListTx"
                @preview="handlePreviewTx"
                @change="handleChangesTx"
              >
                <div v-if="fileListTx.length < 1">
                  <a-icon type="plus" />
                  <div class="ant-upload-text">上传图片</div>
                </div>
              </a-upload>
              <a-modal
                :visible="previewVisibleTx"
                :footer="null"
                @cancel="handleCancelTx"
              >
                <img alt="example" style="width: 100%" :src="previewImageTx" />
              </a-modal>
              <div style="color: #ccc">
                支持格式：JPG、JPEG、PNG，最多上传1张照片，单个不超过5M
              </div>
            </a-form-model-item>
            <a-form-model-item label="姓名" prop="theName">
              <a-input size="large" v-model="registerForm_zj.theName"></a-input>
            </a-form-model-item>
            <a-form-model-item label="性别" prop="resource">
              <a-radio-group v-model="registerForm_zj.resource">
                <a-radio value="1"> 男 </a-radio>
                <a-radio value="2"> 女 </a-radio>
              </a-radio-group>
            </a-form-model-item>
            <a-form-model-item label="专家职称" prop="expertsTitles">
              <a-input-group compact>
                <a-select
                  style="width: 100%"
                  size="large"
                  v-model="registerForm_zj.expertsTitles"
                >
                  <a-select-option
                    :value="item.id"
                    v-for="item in zjTitleList"
                    :key="item.title"
                  >
                    {{ item.title }}
                  </a-select-option>
                </a-select>
              </a-input-group>
            </a-form-model-item>
            <a-form-model-item label="擅长领域" prop="goodField">
              <a-input-group compact>
                <a-select
                  style="width: 100%"
                  v-model="registerForm_zj.goodField"
                  mode="multiple"
                  @search="handleSearch"
                  @change="handleSearchChanges"
                  :allowClear="true"
                  placeholder="请选择"
                >
                  <a-select-option
                    :value="item.value"
                    v-for="item in zjInfoList"
                    :key="item.label"
                  >
                    {{ item.label }}
                  </a-select-option>
                </a-select>
              </a-input-group>
            </a-form-model-item>
            <a-form-model-item label="个人简介" prop="personalProfile">
              <a-textarea
                placeholder="请输入内容"
                :autoSize="{ minRows: 4 }"
                :maxLength="500"
                v-model="registerForm_zj.personalProfile"
              />
            </a-form-model-item>
            <a-form-model-item label="出生日期" prop="zjFoundDate">
              <a-date-picker
                :value="registerForm_zj.zjFoundDate"
                size="large"
                @change="onDateChangeZj"
              />
            </a-form-model-item>
            <a-form-model-item label="工作地址" prop="zjBusinessAddress">
              <a-input-group compact>
                <a-cascader
                  style="width: 50%"
                  :options="businessAdressBase"
                  placeholder="请选择省市县地区"
                  size="large"
                  :value="[
                    registerForm_zj.zjProvinceCode,
                    registerForm_zj.zjCityCode,
                    registerForm_zj.zjCountyCode,
                  ]"
                  @change="addressChange2"
                />
                <a-input
                  size="large"
                  placeholder="请输入详细地址"
                  style="width: 50%"
                  v-model="registerForm_zj.zjBusinessAddress"
                ></a-input>
              </a-input-group>
            </a-form-model-item>
            <a-form-model-item label="工作单位" prop="workUnits">
              <a-input
                size="large"
                v-model="registerForm_zj.workUnits"
              ></a-input>
            </a-form-model-item>
            <a-form-model-item label="个人成就" prop="personalAchievement">
              <a-textarea
                placeholder="请输入内容"
                :autoSize="{ minRows: 4 }"
                :maxLength="500"
                v-model="registerForm_zj.personalAchievement"
              />
            </a-form-model-item>
            <a-form-model-item label="身份证号" prop="zjIdNumber">
              <a-input
                size="large"
                v-model="registerForm_zj.zjIdNumber"
              ></a-input>
            </a-form-model-item>
            <a-form-model-item label="身份证照片" prop="idCardPhoto">
              <!-- <div style="position: relative">
                <span
                  style="
                    position: absolute;
                    color: red;
                    z-index: 999;
                    top: 2px;
                    left: -90px;
                  "
                  >*</span
                >
              </div> -->
              <a-upload
                action="/fms/api/uploadForAmis"
                list-type="picture-card"
                :file-list="fileList"
                @preview="handlePreview"
                @change="handleChanges"
              >
                <div v-if="fileList.length < 2">
                  <a-icon type="plus" />
                  <div class="ant-upload-text">上传图片</div>
                </div>
              </a-upload>
              <a-modal
                :visible="previewVisible"
                :footer="null"
                @cancel="handleCancel"
              >
                <img alt="example" style="width: 100%" :src="previewImage" />
              </a-modal>
              <div style="color: #ccc">
                支持格式：JPG、JPEG、PNG，最多上传2张照片，单个不超过5M
              </div>
            </a-form-model-item>
            <a-form-model-item
              label="专家职称照片"
              prop="businessCertificateImg"
            >
              <!-- <div style="position: relative">
                <span
                  style="
                    position: absolute;
                    color: red;
                    z-index: 999;
                    top: 2px;
                    left: -78px;
                  "
                  >*</span
                >
              </div> -->
              <a-upload
                action="/fms/api/uploadForAmis"
                list-type="picture-card"
                :file-list="fileListZc"
                @preview="handlePreviewZc"
                @change="handleChangesZc"
              >
                <div v-if="fileListZc.length < 1">
                  <a-icon type="plus" />
                  <div class="ant-upload-text">上传图片</div>
                </div>
              </a-upload>
              <a-modal
                :visible="previewVisibleZc"
                :footer="null"
                @cancel="handleCancelZc"
              >
                <img alt="example" style="width: 100%" :src="previewImageZc" />
              </a-modal>
              <div style="color: #ccc">
                支持格式：JPG、JPEG、PNG，最多上传1张照片，单个不超过5M
              </div>
            </a-form-model-item>
            <!-- 企业选择省市区地址以及详细地址 -->
            <!-- 辅助注册 删除经营地址校验规则-->
            <!-- <a-form-model-item label="经营地址" prop = "businessAdress"> -->

            <!-- 底部按钮区域 -->
            <a-form-model-item
              label=""
              :wrapper-col="{ span: 14, offset: 4 }"
              class="bottom-button"
            >
              <!-- <a-button style="margin-right: 30px" @click="goToPrev"
                >上一步</a-button
              > -->
              <a-button type="primary" @click="goToNextZj">下一步</a-button>
            </a-form-model-item>
          </a-form-model>
        </div>
        <!-- 步骤条第三部分 提交审核 -->
        <div v-show="current == 2">
          <div class="stepsThirdContent">
            <a-icon v-if="!reviewTypes" type="check-circle" class="successIcon" />
            <a-icon v-if="reviewTypes" type="exclamation-circle" class="successIcon" />
            <div v-if="!reviewTypes">审核通过</div>
            <div v-if="reviewTypes">待审核</div>
            <a-button
              v-if="!reviewTypes"
              @click="$router.push('/login')"
              type="primary"
              class="steps3LoginBtn"
            >
              去登录
            </a-button>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- <page-footer :link-list="footerLinks" :copyright="copyright"></page-footer> -->
</template>

<script>
// import PageFooter from '@/layouts/footer/PageFooter'
// 图片转换函数
function getBase64(img, callback) {
  const reader = new FileReader();
  reader.addEventListener("load", () => callback(reader.result));
  reader.readAsDataURL(img);
}
function getBase64s(file) {
  return new Promise((resolve, reject) => {
    const reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = () => resolve(reader.result);
    reader.onerror = (error) => reject(error);
  });
}
import { mapState } from "vuex";
import {
  isUserNameValid,
  isMobilePhoneValid,
  getMobilePhoneYZM,
  userRegister,
  businessInfoSave,
  businessInfoOfType,
  businessInfoOfAdress,
  registrationType,
  zjInfoOfType,
  zjTitleOfType,
  businessExperts,
  rejectExpert,
  enterpriseDetail,
  farmerRegistration,
} from "@/services/user";
import options from "@/utils/city.js";
export default {
  name: "CommonLayout",
  data() {
    // 自定义校验规则
    // 1.自定义校验规则,校验用户名是否重复
    let checkLoginName = (rule, value, callback) => {
      // clearTimeout(checkPending);
      // if (!value) {
      //   return callback(new Error('Please input the age'));
      // }
      // checkPending = setTimeout(() => {
      //   if (!Number.isInteger(value)) {
      //     callback(new Error('Please input digits'));
      //   } else {
      //     if (value < 18) {
      //       callback(new Error('Age must be greater than 18'));
      //     } else {
      //       callback();
      //     }
      //   }
      // }, 1000);
      isUserNameValid(value).then((res) => {
        if (res.data.data) {
          callback();
        } else {
          callback(new Error("用户名已经存在"));
        }
      });
    };
    // 2.自定义校验规则,验证手机号合法,以及验证手机号唯一
    let checkMobilePhone = (rule, value, callback) => {
      var reg =
        /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1})|(19[0-9]{1}))+\d{8})$/;
      if (reg.test(value)) {
        // 如果合法,然后发送请求校验唯一
        isMobilePhoneValid(value).then((res) => {
          if (res.data.data) {
            this.phoneRegistered = true;
            callback();
          } else {
            this.phoneRegistered = false;
            callback(new Error("该手机号已被注册"));
          }
        });
      } else {
        // 如果不合法,提示输入正确的手机号
        callback(new Error("请输入正确的手机号"));
      }
    };
    //验证手机号
    let MobilePhoneCheck = (rule, value, callback) => {
      var reg =
        /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1})|(19[0-9]{1}))+\d{8})$/;
      if (reg.test(value) || value == "") {
        callback();
      } else {
        // 如果不合法,提示输入正确的手机号
        callback(new Error("请输入正确的手机号"));
      }
    };
    // 3.自定义校验规则,验证确认密码和设置密码是否相同
    let checkPasswordValid = (rule, value, callback) => {
      if (value !== this.registerForm_1.password) {
        callback(new Error("两次输入的密码不一致"));
      } else {
        callback();
      }
    };
    //身份证校验
    let VerificationIdentityCard = (rule, value, callback) => {
      var reg =
        /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
      if (reg.test(value)) {
        callback();
      } else {
        callback(new Error("请输入正确的身份证号信息"));
      }
    };
    //专家身份证校验
    let VerificationIdentityCardZj = (rule, value, callback) => {
      var reg =
        /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
      if (reg.test(value) || value == '') {
        callback();
      } else {
        callback(new Error("请输入正确的身份证号信息"));
      }
    };
    // 自定义校验规则,校验图片是否上传
    let checkImage = (rule, value, callback) => {
      if (!this.imageUrl) callback(new Error("请上传营业执照"));
      else callback();
    };
    let txImage = (rule, value, callback) => {
      if (this.fileListTx.length<=0) callback(new Error("请上传头像"));
      else callback();
    };
    let yzcImage = (rule, value, callback) => {
      if (this.fileList.length<=0) callback(new Error("请上传营业执照"));
      else callback();
    };
    // 自定校验规则,检验经营地址是否填写
    let checkBusinessAddress = (rule, value, callback) => {
      if (
        !this.registerForm_2.businessProvinceCode ||
        !this.registerForm_2.businessCityCode ||
        !this.registerForm_2.businessCountyCode
      ) {
        callback(new Error("请完善经营地址信息"));
      } else {
        callback();
      }
    };
    //养殖场地址校验
    // let yzcAddress = (rule, value, callback) => {
    //   console.log(this.registerForm_yzc);
    //   if (
    //     !this.registerForm_yzc.yzcProvinceCode ||
    //     !this.registerForm_yzc.yzcCityCode ||
    //     !this.registerForm_yzc.yzcCountyCode
    //   ) {
    //     callback();
    //   } else {
    //     callback(new Error("请完善经营地址信息"));
    //   }
    // };

    return {
      phoneRegistered: false,
      previewVisible: false,
      previewImage: "",
      fileList: [],
      fileListTx: [],
      previewVisibleTx: false,
      previewImageTx: "",
      fileListZc: [],
      previewVisibleZc: false,
      previewImageZc: "",
      loginUserId: this.$route.query.loginUserId,
      // 注册成功返回的管理员id
      tenantAdminId: "",
      // 步骤条控制器
      // current: +this.$route.query.current,
      current: this.$route.query.current / 1 || 0,
      catalogue: this.$route.query.catalogue / 1 || 0,
      reviewTypes: this.$route.query.reviewTypes || true,
      reviewResults: this.$route.query.reviewResults || false,
      steps: [
        { title: "申请账号" },
        { title: "信息录入" },
        { title: "提交审核" },
      ],
      labelCol: { span: 4 },
      wrapperCol: { span: 14 },
      text: "获取验证码",
      // 注册页第一页表单数据
      registerForm_1: {
        loginName: "",
        password: "",
        mobilePhone: "",
        verifyCode: "",
        passwordSecond: "",
        roleCode: "",
      },
      // 注册页第二页表单数据
      registerForm_2: {
        enterpriseName: "",
        unifiedSocialCreditCode: "",
        foundDate: "",
        // 企业类型   暂时写死
        enterpriseTypeCode: "",
        // 企业属性   暂时写死
        enterprisePropCode: "",
        representativeName: "",
        enterpriseContactPhone: "",
        // 地址编码   暂时写死
        businessProvinceCode: "",
        businessCityCode: "",
        businessCountyCode: "",
        businessTownshipCode: "",
        businessAddress: "",
        registeredCapital: "",
        businessScope: "",
        // 营业执照图片id    暂未获得
        // businessCertificateImg:"",
        // 辅助注册 写死图片id
        businessCertificateImg: "",
      },
      //第二页养殖场
      registerForm_yzc: {
        yzcName: "",
        yzcCreditCode: "",
        yzcEnterpriseName: "",
        yzcContactNumber: "",
        yzcBusinessAddress: "",
        yzcBusinessScope: "",
        yzcCertificateImg: "",
        yzcProvinceCode: "",
        yzcCityCode: "",
        yzcCountyCode: "",
        yzcDate: "",
      },
      registerForm_zj: {
        headPortrait: "",
        theName: "",
        resource: "",
        expertsTitles: "",
        goodField: [],
        personalProfile: "",
        zjFoundDate: "",
        zjBusinessAddress: "",
        zjProvinceCode: "",
        zjCityCode: "",
        zjCountyCode: "",
        zjIdNumber: "",
        personalAchievement: "",
        workUnits: "",
        idCardPhoto: "",
        businessCertificateImg: "",
      },
      // 确认密码
      // checkPassword:'',
      // 发送验证码按钮,默认可以发送
      disabled: false,
      // 用户是否勾选同意用户协议校验码
      checkBoxStatus: false,
      // 第一步骤中校验规则
      firstRules: {
        loginName: [
          { required: true, message: "请输入用户名", trigger: "blur" },
          { validator: checkLoginName, trigger: "blur" },
        ],
        mobilePhone: [
          { required: true, message: "请输入手机号码", trigger: "blur" },
          { validator: checkMobilePhone, trigger: "blur" },
        ],
        verifyCode: [
          { required: true, message: "验证码不能为空", trigger: "blur" },
        ],
        password: [
          { required: true, message: "密码不能为空", trigger: "blur" },
          { min: 6, max: 20, message: "密码长度为6-20位", trigger: "blur" },
        ],
        passwordSecond: [
          { required: true, message: "请再次输入密码", trigger: "blur" },
          { validator: checkPasswordValid, trigger: "blur" },
        ],
        roleCode: [
          { required: true, message: "请选择注册类型", trigger: "blur" },
        ],
      },
      // 第二步骤中校验规则
      secondRules: {
        enterpriseName: [
          { required: true, message: "请输入企业名称", trigger: "blur" },
        ],
        unifiedSocialCreditCode: [
          {
            required: true,
            message: "请输入统一社会信用代码",
            trigger: "blur",
          },
        ],
        foundDate: [
          { required: true, message: "请输入企业成立日期", trigger: "blur" },
        ],
        enterpriseTypeCode: [
          { required: true, message: "请选择企业类型", trigger: "blur" },
        ],
        enterprisePropCode: [
          { required: true, message: "请选择企业属性", trigger: "blur" },
        ],
        representativeName: [
          { required: true, message: "请输入法定代表人", trigger: "blur" },
        ],
        // 辅助注册 移除经营地址校验规则
        businessAddress: [
          { required: true, message: "请完善经营地址", trigger: "blur" },
          { validator: checkBusinessAddress, trigger: ["change", "blur"] },
        ],
        registeredCapital: [
          { required: true, message: "请输入总注册资本", trigger: "blur" },
        ],
        businessScope: [
          { required: true, message: "请输入经营范围", trigger: "blur" },
        ],
        // 辅助注册 注释营业执照校验规则
        businessCertificateImg: [{ validator: checkImage, trigger: "blur" }],
      },
      // 第二步骤中养殖场校验规则
      secondRules1: {
        yzcName: [
          { required: true, message: "请输入养殖场名称", trigger: "blur" },
        ],
        yzcCreditCode: [
          {
            required: true,
            message: "请输入身份证号信息",
            trigger: "blur",
          },
          { validator: VerificationIdentityCard, trigger: "blur" },
        ],
        yzcDate: [
          { required: true, message: "请输入成立日期", trigger: "blur" },
        ],
        yzcEnterpriseName: [
          { required: true, message: "请选择负责人", trigger: "blur" },
        ],
        yzcContactNumber: [{ validator: MobilePhoneCheck, trigger: "blur" }],
        // representativeName: [
        //   { required: true, message: "请输入法定代表人", trigger: "blur" },
        // ],
        // 辅助注册 移除经营地址校验规则
        yzcBusinessAddress: [
          { required: true, message: "请完善地址", trigger: "blur" },
        ],
        // registeredCapital: [
        //   { required: true, message: "请输入总注册资本", trigger: "blur" },
        // ],
        yzcBusinessScope: [
          { required: true, message: "请输入经营范围", trigger: "blur" },
        ],
        // 辅助注册 注释营业执照校验规则
        yzcCertificateImg: [{ validator: yzcImage, trigger: "blur" }],
      },
      // 第二步骤中校验规则
      secondRules2: {
        theName: [
          { required: true, message: "请输入姓名", trigger: "blur" },
        ],
        headPortrait: [{ validator: txImage, trigger: "blur" }],
        expertsTitles: [
          { required: true, message: "请输入专家职称", trigger: "blur" },
        ],
        personalProfile: [
          { required: true, message: "请输入个人简介", trigger: "blur" },
        ],
        zjIdNumber: [
          { validator: VerificationIdentityCardZj, trigger: "blur" },
        ],
        goodField:[
          { required: true, message: "请输入擅长领域", trigger: "blur" },
        ],
        workUnits:[
          { required: true, message: "请输入工作单位", trigger: "blur" },
        ],
        // unifiedSocialCreditCode: [
        //   {
        //     required: true,
        //     message: "请输入统一社会信用代码",
        //     trigger: "blur",
        //   },
        // ],
        // foundDate: [
        //   { required: true, message: "请输入企业成立日期", trigger: "blur" },
        // ],
        // enterpriseTypeCode: [
        //   { required: true, message: "请选择企业类型", trigger: "blur" },
        // ],
        // enterprisePropCode: [
        //   { required: true, message: "请选择企业属性", trigger: "blur" },
        // ],
        // representativeName: [
        //   { required: true, message: "请输入法定代表人", trigger: "blur" },
        // ],
        // // 辅助注册 移除经营地址校验规则
        // businessAddress: [
        //   { required: true, message: "请完善经营地址", trigger: "blur" },
        //   { validator: checkBusinessAddress, trigger: ["change", "blur"] },
        // ],
        // registeredCapital: [
        //   { required: true, message: "请输入总注册资本", trigger: "blur" },
        // ],
        // businessScope: [
        //   { required: true, message: "请输入经营范围", trigger: "blur" },
        // ],
        // // 辅助注册 注释营业执照校验规则
        // businessCertificateImg: [{ validator: checkImage, trigger: "blur" }],
      },
      // 第二步骤城市列表
      options: options,
      // 图片上传控制属性
      loading: false,
      imageUrl: "",
      //注册类型
      RegistrationList: [],
      // 企业类型
      businessTypeArr: [],
      // 企业属性
      businessPropArr: [],
      // 企业地址
      businessAdressBase: [],
      zjInfoList: [],
      zjTitleList: [],
      //企业辨别类型
      enterpriseRegisterTypeCode: this.$route.query.enterpriseRegisterTypeCode || '',
      milkStationFlag: this.$route.query.milkStationFlag || '',
      goodFields: "",
      auditTime: "",
      auditPerson: "",
      auditOpinion: "",
      auditStatus: "",
    };
  },
  // components: {PageFooter},
  /**
   *  created函数请求初始化数据
   *  1.企业属性 2.企业类型 3.企业地址级联器配置
   */
  created() {
    if (this.reviewResults && this.catalogue == 2) {
      rejectExpert(this.loginUserId).then((res) => {
        if (res.data.status == 0) {
          let val = res.data.data;
          this.tenantAdminId = val.userId;
          this.auditTime = val.auditTime;
          this.auditPerson = val.auditPerson;
          this.auditOpinion = val.auditOpinion;
          this.auditStatus = val.auditStatus == 2 ? "驳回" : "";
          let registerForm_zj = {
            headPortrait: val.photo,
            theName: val.name,
            resource: val.sex == "男" ? "1" : "2",
            expertsTitles: val.expertTitle.id,
            goodField: val.types.map((item) => item.code),
            personalProfile: val.expertIntroduce,
            zjFoundDate: val.birthday,
            zjBusinessAddress: val.address,
            zjProvinceCode: val.city.provinceCode,
            zjCityCode: val.city.cityCode,
            zjCountyCode: val.county.countyCode,
            zjIdNumber: val.idCardNum,
            personalAchievement: val.achievement,
            workUnits: val.workUnit,
            idCardPhoto: val.idCardImage,
            businessCertificateImg: val.expertTitleImage,
          };
          this.fileListTx = [
            { uid: "-1", name: "image.png", status: "done", url: val.photo },
          ];
          this.fileListZc = [
            {
              uid: "-1",
              name: "image.png",
              status: "done",
              url: val.expertTitleImage,
            },
          ];
          let fileList = val.idCardImage.split(",");
          this.fileList = [];
          fileList.map((item, index) => {
            this.fileList.push({
              uid: "-" + (index + 1),
              name: "image.png",
              status: "done",
              url: item,
            });
          });
          // this.fileList = [
          //   {uid: '-1',
          // name: 'image.png',
          // status: 'done',url:val.photo},
          // {uid: '-1',
          // name: 'image.png',
          // status: 'done',url:val.photo}
          // ]
          this.registerForm_zj = registerForm_zj;
        }
      });
    }
    if (this.reviewResults && (this.catalogue == 0 || this.catalogue == 1)) {
      enterpriseDetail(this.loginUserId).then((res) => {
        if (res.data.status == 0) {
          let val = res.data.data;
          this.tenantAdminId = val.userId;
          this.enterpriseRegisterTypeCode = val.enterpriseRegisterTypeCode;
          this.milkStationFlag = val.milkStationFlag;
          this.auditTime = val.auditTime;
          this.auditPerson = val.auditPerson;
          this.auditOpinion = val.auditOpinion;
          this.auditStatus = val.auditStatus == 2 ? "驳回" : "";
          if (this.catalogue == 0) {
            this.imageUrl = val.businessCertificateImg
            let registerForm_2 = {
              enterpriseName: val.enterpriseName,
              unifiedSocialCreditCode: val.unifiedSocialCreditCode,
              foundDate: val.foundDate,
              // 企业类型   暂时写死
              enterpriseTypeCode: val.enterpriseTypeCode,
              // 企业属性   暂时写死
              enterprisePropCode: val.enterprisePropCode,
              representativeName: val.representativeName,
              enterpriseContactPhone: val.enterpriseContactPhone,
              // 地址编码   暂时写死
              businessProvinceCode: val.businessProvinceCode,
              businessCityCode: val.businessCityCode,
              businessCountyCode: val.businessCountyCode,
              businessTownshipCode: "",
              businessAddress: val.businessAddress,
              registeredCapital: val.registeredCapital,
              businessScope: val.businessScope,
              // 营业执照图片id    暂未获得
              // businessCertificateImg:"",
              // 辅助注册 写死图片id
              businessCertificateImg: val.businessCertificateImg,
            };
            this.registerForm_2 = registerForm_2;
          } else {
            let registerForm_yzc = {
              yzcName: val.enterpriseName,
              yzcCreditCode: val.unifiedSocialCreditCode,
              yzcEnterpriseName: val.representativeName,
              yzcContactNumber: val.enterpriseContactPhone,
              yzcBusinessAddress: val.businessAddress,
              yzcBusinessScope: val.businessScope,
              yzcCertificateImg: val.idCardNumImg,
              yzcProvinceCode: val.businessProvinceCode,
              yzcCityCode: val.businessCityCode,
              yzcCountyCode: val.businessCountyCode,
              yzcDate: val.foundDate,
            };
            let fileList = val.idCardNumImg.split(",");
            this.fileList = [];
            fileList.map((item, index) => {
              this.fileList.push({
                uid: "-" + (index + 1),
                name: "image.png",
                status: "done",
                url: item,
              });
            });
            this.registerForm_yzc = registerForm_yzc;
          }
        }
      });
    }
    //注册类型
    registrationType().then((res) => {
      this.RegistrationList = res.data.data.rows;
    });
    // 企业类型
    businessInfoOfType("T000010_ENTERPRISETYPE").then((res) => {
      this.businessTypeArr = res.data.data.rows;
    });
    // 专家分类
    zjInfoOfType("T000010_BIZ_EXPERT_TYPE").then((res) => {
      this.zjInfoList = res.data.data.options;
    });
    //专家职称
    zjTitleOfType(this.registerForm_1.roleCode || "expert").then((res) => {
      this.zjTitleList = res.data.data.rows;
    });
    // 企业属性
    businessInfoOfType("T000010_ENTERPRISEPROP").then((res) => {
      this.businessPropArr = res.data.data.rows;
    });
    // 企业地址级联器配置
    businessInfoOfAdress().then((res) => {
      this.businessAdressBase = res.data.data.rows;
    });
  },
  methods: {
    handleSearch(value) {
      console.log("handleSearch", value);
    },
    handleSearchChanges(value) {
      this.registerForm_zj.goodField = value;
      this.goodFields = value.join(",");
    },
    handleCancel() {
      this.previewVisible = false;
    },
    async handlePreview(file) {
      if (!file.url && !file.preview) {
        file.preview = await getBase64s(file.originFileObj);
      }
      this.previewImage = file.url || file.preview;
      this.previewVisible = true;
    },
    handleChanges({ fileList }) {
      this.fileList = fileList;
      this.registerForm_zj.idCardPhoto = fileList
        .map((item) => {
          return !!item.response.data && item.response.data.url;
        })
        .join(",");
      this.registerForm_yzc.yzcCertificateImg = fileList
        .map((item) => {
          return !!item.response.data && item.response.data.url;
        })
        .join(",");
    },
    handleCancelTx() {
      this.previewVisibleTx = false;
    },
    async handlePreviewTx(file) {
      if (!file.url && !file.preview) {
        file.preview = await getBase64s(file.originFileObj);
      }
      this.previewImageTx = file.url || file.preview;
      this.previewVisibleTx = true;
    },
    handleChangesTx({ fileList }) {
      this.fileListTx = fileList;
      this.registerForm_zj.headPortrait =
        !!fileList[0].response.data && fileList[0].response.data.url;
    },
    handleCancelZc() {
      this.previewVisibleZc = false;
    },
    async handlePreviewZc(file) {
      if (!file.url && !file.preview) {
        file.preview = await getBase64s(file.originFileObj);
      }
      this.previewImageZc = file.url || file.preview;
      this.previewVisibleZc = true;
    },
    handleChangesZc({ fileList }) {
      this.fileListZc = fileList;
      this.registerForm_zj.businessCertificateImg =
        !!fileList[0].response.data && fileList[0].response.data.url;
    },
    // 地址级联选择器响应事件
    addressChange(value) {
      this.registerForm_2.businessProvinceCode = value[0];
      this.registerForm_2.businessCityCode = value[1];
      this.registerForm_2.businessCountyCode = value[2];
    },
    addressChange1(value) {
      this.registerForm_yzc.yzcProvinceCode = value[0];
      this.registerForm_yzc.yzcCityCode = value[1];
      this.registerForm_yzc.yzcCountyCode = value[2];
    },
    addressChange2(value) {
      this.registerForm_zj.zjProvinceCode = value[0];
      this.registerForm_zj.zjCityCode = value[1];
      this.registerForm_zj.zjCountyCode = value[2];
    },
    // 返回上一步
    goToPrev() {
      this.current--;
    },
    // 返回下一步
    goToNextZj() {
      // TODO 必须在表单校验合格的前提下才发出网络请求
      this.$refs.registerFormRefZj.validate((valid) => {
        if (valid) {
          //TODO 提交企业信息的录入请求,成功才跳转 提交审核页面
          businessExperts({
            ...this.registerForm_zj,
            userId: this.tenantAdminId || this.loginUserId  ,
            goodFields: this.goodFields,
          }).then((res) => {
            // TODO 需要判断企业信息提交成功才能跳转第三个步骤条
            if (res.data.status == 0) {
              this.current++;
              this.reviewResults = false;
            }
            console.log(res);
          });
        } else {
          return false;
        }
      });
    },
    goToNextYzc() {
      // TODO 必须在表单校验合格的前提下才发出网络请求
      this.$refs.registerFormRefYzc.validate((valid) => {
        if (valid) {
          //TODO 提交企业信息的录入请求,成功才跳转 提交审核页面
          farmerRegistration({
            ...this.registerForm_yzc,
            milkStationFlag: this.milkStationFlag,
            userId: this.tenantAdminId || this.loginUserId,
          }).then((res) => {
            // TODO 需要判断企业信息提交成功才能跳转第三个步骤条
            if (res.data.status == 0) {
              this.reviewResults = false;
              this.current++;
            }
            console.log(res);
          });
        } else {
          return false;
        }
      });
    },
    goToNext() {
      // TODO 必须在表单校验合格的前提下才发出网络请求
      this.$refs.registerFormRef2.validate((valid) => {
        if (valid) {
          //TODO 提交企业信息的录入请求,成功才跳转 提交审核页面
          businessInfoSave(this.registerForm_1.loginName, {
            ...this.registerForm_2,
            enterpriseRegisterTypeCode: this.enterpriseRegisterTypeCode,
            milkStationFlag: this.milkStationFlag,
            userId: this.tenantAdminId || this.loginUserId,
          }).then((res) => {
            // TODO 需要判断企业信息提交成功才能跳转第三个步骤条
            if (res.data.status == 0) {
              this.reviewResults = false;
              this.current++;
            }

            console.log(res);
          });
        } else {
          return false;
        }
      });
    },
    // 企业日期选择回调函数
    onDateChange(date, dateString) {
      this.registerForm_2.foundDate = dateString;
    },
    // 养殖场日期选择回调函数
    onDateChangeYzc(date, dateString) {
      this.registerForm_yzc.yzcDate = dateString;
    },
    // 养殖场日期选择回调函数
    onDateChangeZj(date, dateString) {
      this.registerForm_zj.zjFoundDate = dateString;
    },
    // 图片上传以及转化
    handleChange(info) {
      if (info.file.status === "uploading") {
        this.loading = true;
        return;
      }
      if (info.file.status === "done") {
        // Get this url from response in real world.
        getBase64(info.file.originFileObj, (imageUrl) => {
          this.imageUrl = imageUrl;
          this.loading = false;
        });
      }
      // console.log(info);
      // console.log(info.file);
      // console.log(info.file.response);
      // console.log(info.file.response.data);
      // console.log(info.file.response.data.value);
      this.registerForm_2.businessCertificateImg =
        info.file.response.data.value;
      console.log(
        "营业执照上传数据" + this.registerForm_2.businessCertificateImg
      );
    },
    //养殖场图片上传以及简化
    // handleChangeYzc(info) {
    //   if (info.file.status === "uploading") {
    //     this.loading = true;
    //     return;
    //   }
    //   if (info.file.status === "done") {
    //     // Get this url from response in real world.
    //     getBase64(info.file.originFileObj, (imageUrl) => {
    //       this.imageUrl = imageUrl;
    //       console.log(imageUrl, 7788);
    //       this.loading = false;
    //     });
    //   }
    //   // console.log(info);
    //   // console.log(info.file);
    //   // console.log(info.file.response);
    //   // console.log(info.file.response.data);
    //   // console.log(info.file.response.data.value);
    //   this.registerForm_yzc.yzcCertificateImg = info.file.response.data.value;
    //   console.log(
    //     "养殖场营业执照上传数据" + this.registerForm_yzc.yzcCertificateImg
    //   );
    // },
    // 限制步骤二企业上传图片的大小
    beforeUpload(file) {
      const isJpgOrPng =
        file.type === "image/jpeg" ||
        file.type === "image/png" ||
        file.type === "image/jpg";
      if (!isJpgOrPng) {
        this.$message.error("请输入正确的图片格式");
      }
      const isLt2M = file.size / 1024 / 1024 < 5;
      if (!isLt2M) {
        this.$message.error("单个图片最大允许5M");
      }
      return isJpgOrPng && isLt2M;
    },
    // 用户点击注册
    onSubmit() {
      this.$refs.registerFormRef.validate((valid) => {
        if (valid && this.checkBoxStatus) {
          // 校验通过提交注册,跳转下一个步骤条
          // 发送注册网络请求
          userRegister(this.registerForm_1.loginName, this.registerForm_1).then(
            (res) => {
              console.log("------------");
              console.log(res);
              if (res.data.status == 0) {
                // 保存注册成功的企业id(租户管理员id)
                this.tenantAdminId = res.data.data.userAccId;
                // 注册成功,步骤条切换
                if (this.registerForm_1.roleCode == "expert") {
                  this.catalogue = 2;
                } else if (
                  this.registerForm_1.roleCode == "farmersMilkStation" ||
                  this.registerForm_1.roleCode == "farmers"
                ) {
                  this.catalogue = 1;
                } else {
                  this.catalogue = 0;
                }
                if (
                  this.registerForm_1.roleCode ==
                    "breedEnterpriseMilkStation" ||
                  this.registerForm_1.roleCode == "breedEnterprise"
                ) {
                  this.enterpriseRegisterTypeCode = "BREED_ENTERPRISE";
                } else if (this.registerForm_1.roleCode == "machinEnterprise") {
                  this.enterpriseRegisterTypeCode = "PROCESSING_ENTERPRISE";
                }
                if (
                  this.registerForm_1.roleCode ==
                    "breedEnterpriseMilkStation" ||
                  this.registerForm_1.roleCode == "machinEnterprise" ||
                  this.registerForm_1.roleCode == "farmersMilkStation"
                ) {
                  this.milkStationFlag = 0;
                } else if (
                  this.registerForm_1.roleCode == "breedEnterprise" ||
                  this.registerForm_1.roleCode == "farmers"
                ) {
                  this.milkStationFlag = 1;
                }
                this.current = 1;
              }
            }
          );
        } else {
          // 校验未通过
          // TODO 此处为了方便开发调试,注册失败依然可以跳转企业信息录入
          // this.current = 1
          return false;
        }
      });
    },
    // 用户是否勾选同意用户协议
    onChange(e) {
      console.log(e.target.checked);
      this.checkBoxStatus = e.target.checked;
    },
    // 点击按钮发送手机验证码
    sendCode() {
      var reg = /^1(3|4|5|6|7|8|9)\d{9}$/;
      if (reg.test(this.registerForm_1.mobilePhone) && this.phoneRegistered) {
        // 手机号合法,准备发送获取验证码
        getMobilePhoneYZM(this.registerForm_1.loginName, {
          phoneNumber: this.registerForm_1.mobilePhone,
        })
          .then((res) => {
            if (res.data.data.status == 0) {
              this.$message.success("验证码发送成功");
            } else {
              this.$message.error("验证码发送失败");
            }
          })
          .catch((err) => {
            console.log(err);
          });
        let n = 60;
        this.disabled = true;
        const int = setInterval(() => {
          this.text = n + "秒后重新发送";
          n--;
          if (n === 0) {
            this.disabled = false;
            this.text = "获取验证码";
            clearInterval(int);
          }
        }, 1000);
      }
    },
  },
  computed: {
    // ...mapState('setting', ['footerLinks', 'copyright'])
    ...mapState("setting", ["copyright"]),
  },
};
</script>

<style scoped lang="less">
.reviewResults {
  width: 90%;
  > div {
    &:last-child {
      padding-left: 30px;
      margin: 20px;
      > div {
        display: flex;
        justify-content: space-around;
        &:first-child{
          > p {
          width: 46%;
          >span{
            color: #FF3B30;
          }
        }
        }
        > p {
          width: 46%;
          >span:first-child{
            color: #FF3B30;
          }
        }
      }
    }
  }
}
.content {
  width: 100%;
  height: 100%;
  background-color: #fff;
  @media (min-width: 768px) {
    padding: 24px 0 24px;
  }
  .top {
    position: absolute;
    top: 20px;
    left: -0;
    z-index: 99;
    text-align: center;
    .header {
      height: 44px;
      line-height: 44px;
      a {
        text-decoration: none;
      }
      .logo {
        width: 282px;
        height: 50px;
        margin-left: 20px;
        vertical-align: bottom;
        margin-right: 20px;
      }
      .title {
        width: 320px;
        height: 56px;
        font-size: 38px;
        font-family: PingFangSC-Semibold, PingFang SC;
        font-weight: 580;
        color: #333333;
        line-height: 56px;
        position: relative;
        top: 2px;
      }
    }
  }
  .bottom {
    margin-top: 150px;
    padding-bottom: 100px;
    // background-color: #bfa;
    .bottom-content {
      width: 50%;
      margin: 0 auto;
      .steps {
        margin-bottom: 50px;
      }
      .registerBtn {
        width: 100%;
        margin-left: 140px;
        button {
          height: 49px;
          line-height: 49px;
          font-size: 22px;
        }
      }
      .title-style {
        font-weight: bold;
        padding-left: 10px;
        border-left: 5px solid blue;
      }
      .stepsThirdContent {
        // margin-left: 450px;
        margin: 100px auto 0;
        text-align: center;
        // background-color: #bfa;
        .successIcon {
          font-size: 60px;
          color: #19be6b;
        }
        div {
          color: #666666;
          font-size: 30px;
        }
        .steps3LoginBtn {
          width: 12%;
          height: 34px;
          margin-top: 80px;
          font-size: 16px;
          background-color: #19be6b;
        }
      }
    }
  }
}

.avatar-uploader > .ant-upload {
  width: 128px;
  height: 128px;
}
.ant-upload-select-picture-card i {
  font-size: 32px;
  color: #999;
}

.ant-upload-select-picture-card .ant-upload-text {
  margin-top: 8px;
  color: #666;
}

.bottom-button button {
  width: 150px;
}
.bottom-button button:first-child:hover {
  color: #fff;
  background-color: #13c2c2;
}
.sendYZMbtn {
  color: #6bb8ff;
  outline: none;
  border: none;
  box-shadow: none;
  font-size: 13px;
  position: absolute;
  right: 10px;
  top: -7px;
  margin: 0;
  padding: 0;
}
</style>
